26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
51 #pragma package(smart_init)
64 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
66 for(
int x = 0; x < 4; x++)
77 else if(SpeedTagVal == 77)
81 else if(SpeedTagVal == 78)
85 else if(SpeedTagVal == 79)
89 else if(SpeedTagVal == 96)
93 else if(SpeedTagVal == 129)
97 else if(SpeedTagVal == 130)
101 else if(SpeedTagVal == 131)
105 else if(SpeedTagVal == 145)
109 else if(SpeedTagVal == 146)
118 FixedNamedLocationElement(false)
120 for(
int x = 0; x < 4; x++)
131 AnsiString(VLocInput));
144 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
158 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
174 Graphics::TBitmap *GraphicOutput = GraphicPtr;
176 if(LocationName ==
"")
221 GraphicOutput = GraphicPtr;
225 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
227 if((TrackType ==
Simple) && Failed)
239 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
240 AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit01) +
"," + AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit23) +
",EndTrkEl,";
249 Attribute(0), CallingOnSet(false), Length01(
Utilities->DefaultTrackLength), Length23(-1), SpeedLimit01(
Utilities->DefaultTrackSpeedLimit), SpeedLimit23(-1),
250 TrainIDOnElement(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit01(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit23(-1), StationEntryStopLinkPos1(-1), StationEntryStopLinkPos2(-1),
251 SigAspect(FourAspect)
254 for(
int x = 0; x < 4; x++)
270 if(lower.second < higher.second)
274 else if(lower.second > higher.second)
278 else if(lower.second == higher.second)
280 if(lower.first < higher.first)
293 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
294 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
298 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
309 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
337 {2, 4}, {6, 2}, {8, 6}, {4, 8},
338 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
348 else if(
Link[2] == -1)
361 else if(
Link[2] == -1)
370 for(
int x = 0; x < 16; x++)
372 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
548 throw Exception(
"Error in EntryExitNumber 4");
643 throw Exception(
"Error in EntryExitNumber 5");
737 throw Exception(
"Error in EntryExitNumber 6");
824 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1112 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1136 AnsiString NL =
'\n';
1138 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable, perhaps because of failed points; " + NL + NL +
1139 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1140 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1141 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1148 int InternalLinkCheckArray[9][2] =
1149 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1154 for(
int x = 0; x < 9; x++)
1156 for(
int y = 0; y < 2; y++)
1163 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1165 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1166 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1167 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1168 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1169 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1175 int HVArray[10][2] =
1176 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1178 for(
int x = 0; x < 10; x++)
1180 for(
int y = 0; y < 2; y++)
1189 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1192 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1193 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1195 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1196 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1198 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1199 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1202 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1205 for(
int x = 0; x < 40; x++)
1211 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1214 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1215 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1217 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1218 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1220 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1221 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1224 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1227 for(
int x = 0; x < 40; x++)
1233 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1236 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1237 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1239 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1240 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1242 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1243 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1246 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1249 for(
int x = 0; x < 40; x++)
1275 for(
int x = 0; x < 40; x++)
1281 {{68, 0,
RailGraphics->
FSig68}, {69, 0,
RailGraphics->
FSig69}, {70, 0,
RailGraphics->
FSig70}, {71, 0,
RailGraphics->
FSig71}, {72, 0,
RailGraphics->
FSig72},
1284 for(
int x = 0; x < 8; x++)
1290 {{68, 0,
RailGraphics->
FGSig68}, {69, 0,
RailGraphics->
FGSig69}, {70, 0,
RailGraphics->
FGSig70}, {71, 0,
RailGraphics->
FGSig71}, {72, 0,
RailGraphics->
FGSig72},
1293 for(
int x = 0; x < 8; x++)
1320 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1321 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1322 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1323 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1324 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1325 {0, 0, 129}, {0, -1, 145},
1328 for(
int x = 0; x < 25; x++)
1330 for(
int y = 0; y < 3; y++)
1338 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1339 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1340 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1341 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1342 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1343 {0, 0, 129}, {0, 1, 145},
1346 for(
int x = 0; x < 25; x++)
1348 for(
int y = 0; y < 3; y++)
1356 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1357 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1358 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1359 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1360 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1361 {0, 0, 130}, {-1, 0, 146},
1364 for(
int x = 0; x < 25; x++)
1366 for(
int y = 0; y < 3; y++)
1374 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1375 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1376 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1377 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1378 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1379 {0, 0, 130}, {1, 0, 146},
1382 for(
int x = 0; x < 25; x++)
1384 for(
int y = 0; y < 3; y++)
1392 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1393 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1394 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1395 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1396 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1397 {0, -1, 129}, {1, 0, 130},
1398 {-1, 0, 130}, {0, 1, 145},
1399 {0, -1, 145}, {1, 0, 146},
1402 for(
int x = 0; x < 28; x++)
1404 for(
int y = 0; y < 3; y++)
1422 for(
int x = 0; x < 8; x++)
1424 for(
int y = 0; y < 3; y++)
1442 for(
int x = 0; x < 8; x++)
1444 for(
int y = 0; y < 3; y++)
1462 for(
int x = 0; x < 8; x++)
1464 for(
int y = 0; y < 3; y++)
1482 for(
int x = 0; x < 8; x++)
1484 for(
int y = 0; y < 3; y++)
1492 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1494 for(
int x = 0; x < 4; x++)
1496 for(
int y = 0; y < 3; y++)
1504 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1505 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1506 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1507 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1513 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1514 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1515 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1516 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1522 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1523 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1524 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1525 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1531 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1532 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1533 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1534 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1556 delete UGMIt->second;
1632 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1633 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1635 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1642 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1643 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1656 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1657 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1659 {4, 6, 2, 8}, {1, 9, 3, 7},
1661 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1663 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1666 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1667 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1668 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1669 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1670 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1671 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1672 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1674 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1675 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1676 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1677 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1678 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1679 {4, 6, -1, -1}, {2, 8, -1, -1},
1681 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1683 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1685 {4, 6, -1, -1}, {2, 8, -1, -1},
1690 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1691 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1692 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1693 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1696 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1697 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1698 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1700 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1701 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1702 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1704 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1706 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1707 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1708 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1709 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1710 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1711 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1712 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1713 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1714 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1715 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1716 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1717 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1718 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1720 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1721 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1722 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1723 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1724 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1725 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1726 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1727 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1731 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1732 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1733 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1739 for(
int x = 0; x < 17; x++)
1741 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1743 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1747 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1753 ExistingGraphicLoaded(false), Width(16), Height(16)
1765 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1803 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1807 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1811 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1815 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1838 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1841 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1845 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1849 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1883 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1904 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1918 bool TrackPresent =
false;
1932 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1936 TrackPresent =
true;
1941 return(!TrackPresent);
1949 bool TrackPresent =
false;
1958 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1962 TrackPresent =
true;
1968 return(!TrackPresent);
1973 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1976 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1977 TrackEraseSuccessfulFlag =
false;
1982 ErasedTrackVectorPosition = -1;
1983 AnsiString SName =
"", ErrorString;
1985 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1991 TrackMapKeyPair.first = HLocInput;
1992 TrackMapKeyPair.second = VLocInput;
1993 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
2004 if(ErrorString !=
"")
2006 throw Exception(ErrorString +
" for EraseTrackElement 1");
2030 ErasedTrackVectorPosition = VecPos;
2031 TrackEraseSuccessfulFlag =
true;
2037 unsigned int VecPos;
2038 InactiveTrackMapKeyPair.first = HLocInput;
2039 InactiveTrackMapKeyPair.second = VLocInput;
2044 VecPos = InactiveTrack2MultiMapIterator->second;
2049 if(ErrorString !=
"")
2051 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2061 TrackEraseSuccessfulFlag =
true;
2082 VecPos = InactiveTrack2MultiMapIterator->second;
2087 if(ErrorString !=
"")
2089 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2113 if(TrackEraseSuccessfulFlag)
2135 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2136 bool PlatAllowedFlag =
false;
2138 TrackLinkingRequiredFlag =
false;
2150 LocationNameEntry.first =
"";
2158 TempTrackElement.
HLoc = HLocInput;
2159 TempTrackElement.
VLoc = VLocInput;
2185 else if(Aspect == 1)
2189 else if(Aspect == 2)
2193 else if(Aspect == 3)
2202 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2205 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2207 if(InactiveFoundFlag)
2211 NonStationOrLevelCrossingPresent =
true;
2215 NonStationOrLevelCrossingPresent =
true;
2219 PlatformPresent =
true;
2230 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2238 PlatAllowedFlag =
true;
2242 PlatAllowedFlag =
true;
2246 PlatAllowedFlag =
true;
2250 PlatAllowedFlag =
true;
2254 TrackLinkingRequiredFlag =
true;
2282 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2283 (!FoundFlag && !InactiveFoundFlag))
2286 TrackLinkingRequiredFlag =
true;
2318 TrackLinkingRequiredFlag =
true;
2330 else if(FoundFlag || InactiveFoundFlag)
2349 bool BothPointFillets =
true;
2364 TrackLinkingRequiredFlag =
true;
2378 bool InternalChecks)
2382 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2383 bool PlatAllowedFlag =
false;
2385 TrackLinkingRequiredFlag =
false;
2388 LocationNameEntry.first =
"";
2394 TempTrackElement.
HLoc = HLocInput;
2395 TempTrackElement.
VLoc = VLocInput;
2396 for(
int x = 0; x < 4; x++)
2402 TempTrackElement.
Conn[x] = -1;
2406 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2417 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2419 if(InactiveFoundFlag)
2423 NonStationOrLevelCrossingPresent =
true;
2427 NonStationOrLevelCrossingPresent =
true;
2431 PlatformPresent =
true;
2442 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2450 PlatAllowedFlag =
true;
2454 PlatAllowedFlag =
true;
2458 PlatAllowedFlag =
true;
2462 PlatAllowedFlag =
true;
2466 TrackLinkingRequiredFlag =
true;
2497 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2498 (!FoundFlag && !InactiveFoundFlag))
2501 TrackLinkingRequiredFlag =
true;
2536 TrackLinkingRequiredFlag =
true;
2548 else if(FoundFlag || InactiveFoundFlag)
2567 bool BothPointFillets =
true;
2582 TrackLinkingRequiredFlag =
true;
2612 ShowMessage(
"Gaps must be set before track can be validated");
2622 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2633 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2650 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2657 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2681 std::pair<AnsiString, char>TempMapPair;
2689 TempMapPair.second =
'x';
2699 AnsiString Name =
"";
2700 typedef std::list<AnsiString> TNoPlatsList;
2701 TNoPlatsList::iterator NPLIt;
2702 TNoPlatsList NoPlatsList;
2703 typedef std::list<AnsiString> TLocNameList;
2704 TLocNameList LocNameList;
2709 LocNameList.push_back(LNMMIt->first);
2712 LocNameList.unique();
2713 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2717 if(MMRange.first == MMRange.second)
2723 if((LNMMIt->second) < 0)
2737 TempIt = MMRange.second;
2738 if(LNMMIt == --TempIt)
2740 NoPlatsList.push_back(Name);
2744 if(!NoPlatsList.empty())
2746 AnsiString NoPlatsAnsiList =
"";
2747 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2749 NoPlatsAnsiList += *NPLIt +
'\n';
2753 if(NoPlatsList.size() > 1)
2755 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2759 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2774 int NewHLoc, NewVLoc;
2775 bool ConnectionFoundFlag, LinkFoundFlag;
2777 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2779 for(
unsigned int y = 0; y < 4; y++)
2797 ConnectionFoundFlag =
false;
2798 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2804 ConnectionFoundFlag =
true;
2806 LinkFoundFlag =
false;
2807 for(
unsigned int a = 0; a < 4; a++)
2811 LinkFoundFlag =
true;
2827 if(!ConnectionFoundFlag)
2902 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2919 bool UnsetGaps =
false;
2926 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2930 for(
unsigned int y = 0; y < 4; y++)
2942 for(
unsigned int y = 0; y < 4; y++)
2952 for(
unsigned int y = 1; y < 4; y++)
2961 for(
unsigned int y = 0; y < 4; y++)
2974 for(
unsigned int y = 0; y < 4; y++)
3002 int NumberOfActiveElements = 0;
3004 GraphicsFollow =
false;
3008 if(MarkerString[MarkerString.Length()] ==
'1')
3010 GraphicsFollow =
true;
3012 for(
int x = 0; x < NumberOfActiveElements; x++)
3018 TrackElement.
HLoc = TempInt;
3020 TrackElement.
VLoc = TempInt;
3026 TrackElement.
Conn[0] = TempInt;
3050 if((TempInt != -1) && (TempInt < 10))
3060 if((TempInt != -1) && (TempInt < 10))
3077 if(Marker[1] ==
'3')
3081 else if(Marker[1] ==
'2')
3085 else if(Marker[1] ==
'G')
3099 int NumberOfInactiveElements = 0;
3103 for(
int x = 0; x < NumberOfInactiveElements; x++)
3109 TrackElement.
HLoc = TempInt;
3111 TrackElement.
VLoc = TempInt;
3117 bool LocError =
false;
3146 for(
int x = 0; x < NumberOfGraphics; x++)
3157 bool FileError =
false;
3159 for(
int x = 0; x < NumberOfGraphics; x++)
3172 UGME.second =
new TPicture;
3173 UGME.second->LoadFromFile(
UGME.first);
3176 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3183 catch(
const EInvalidGraphic &e)
3192 delete UGMIt->second;
3197 catch(
const Exception &e)
3206 delete UGMIt->second;
3214 bool FoundInMap =
false;
3233 UGME.second =
new TPicture;
3234 UGME.second->LoadFromFile(
UGME.first);
3237 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3244 catch(
const EInvalidGraphic &e)
3253 delete UGMIt->second;
3258 catch(
const Exception &e)
3267 delete UGMIt->second;
3292 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3296 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3298 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3301 VecFile << x <<
'\n';
3302 VecFile << TrackElement.
SpeedTag <<
'\n';
3303 VecFile << TrackElement.
HLoc <<
'\n';
3304 VecFile << TrackElement.
VLoc <<
'\n';
3308 VecFile << TrackElement.
Conn[0] <<
'\n';
3312 VecFile << TrackElement.
Attribute <<
'\n';
3318 VecFile << int(1) <<
'\n';
3322 VecFile << int(0) <<
'\n';
3325 VecFile << TrackElement.
Length01 <<
'\n';
3326 VecFile << TrackElement.
Length23 <<
'\n';
3329 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3336 VecFile <<
"3*****" <<
'\0' <<
'\n';
3340 VecFile <<
"2*****" <<
'\0' <<
'\n';
3344 VecFile <<
"G*****" <<
'\0' <<
'\n';
3348 VecFile <<
"4*****" <<
'\0' <<
'\n';
3353 VecFile <<
"******" <<
'\0' <<
'\n';
3358 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3362 VecFile << x <<
'\n';
3363 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3364 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3365 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3366 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3367 VecFile <<
"******" <<
'\0' <<
'\n';
3382 GraphicsFollow =
false;
3384 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3390 AnsiString MarkerString;
3397 if(MarkerString[MarkerString.Length()] ==
'1')
3399 GraphicsFollow =
true;
3401 for(
int x = 0; x < NumberOfActiveElements; x++)
3409 int SpeedTag = TempInt;
3416 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3422 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3427 if((SpeedTag > 87) && (SpeedTag < 96))
3430 if((TempInt < -1) || (TempInt > 3))
3436 if((TempInt < -1) || (TempInt > 999999))
3442 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3443 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3446 if((TempInt < -1) || (TempInt > 5))
3452 if((SpeedTag >= 68) && (SpeedTag <= 75))
3455 if((TempInt != 0) && (TempInt != 1))
3462 if((TempInt < -1) || (TempInt > 999999))
3468 if((TempInt < -1) || (TempInt > 999999))
3474 if((TempInt < -1) || (TempInt > 999999))
3480 if((TempInt < -1) || (TempInt > 999999))
3501 int NumberOfInactiveElements = 0;
3504 if(NumberOfInactiveElements < 0)
3514 for(
int x = 0; x < NumberOfInactiveElements; x++)
3528 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3534 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3561 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3567 AnsiString FileName =
"", TempStr =
"";
3569 for(
int x = 0; x < NumberOfGraphics; x++)
3571 TPicture *TempPicture =
new TPicture;
3580 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3593 catch(
const EInvalidGraphic &e)
3598 for(
int y = x + 1; y < NumberOfGraphics; y++)
3604 ShowMessage(FileName +
3605 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3610 catch(
const Exception &e)
3615 for(
int y = x + 1; y < NumberOfGraphics; y++)
3621 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3622 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3640 for(
int x = 0; x < VecSize; x++)
3663 for(
int x = 0; x < VecSize; x++)
3685 for(
int x = 0; x < VecSize; x++)
3739 for(
int x = 0; x < VecSize; x++)
3797 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3819 if(BothPointFilletsAndBasicLCs)
3894 Bitmap->Canvas->CopyMode = cmSrcCopy;
3896 Graphics::TBitmap *GraphicOutput;
4071 for(
int x = 0; x < 40; x++)
4100 Graphics::TBitmap *GraphicPtr;
4115 Graphics::TBitmap* SignalPlatformGraphic;
4148 if(OldTransparentColour !=
clB5G5R5)
4171 Bitmap->Canvas->CopyMode = cmSrcCopy;
4199 Bitmap->Canvas->CopyMode = cmSrcCopy;
4201 Graphics::TBitmap *GraphicOutput;
4211 if(BaseElement == 1)
4307 for(
int x = 0; x < 40; x++)
4336 Graphics::TBitmap *GraphicPtr;
4351 Graphics::TBitmap* SignalPlatformGraphic;
4414 for(
int x = 0; x < 40; x++)
4422 Graphics::TBitmap* SignalPlatformGraphic;
4463 if(OldTransparentColour !=
clB5G5R5)
4477 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4549 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4563 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4589 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4614 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4644 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4678 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4715 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4732 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4749 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4779 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4786 throw Exception(
"Error - Map & Vector different sizes");
4788 unsigned int NonZeroCount = 0;
4790 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4799 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4805 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4809 TrackMapEntry.first = TrackMapKeyPair;
4810 TrackMapEntry.second = x;
4811 if(!(
TrackMap.insert(TrackMapEntry).second))
4813 throw Exception(
"Error - map insertion failure, TrackVector in error");
4817 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4819 for(
unsigned int y = 0; y < 4; y++)
4844 THVPair GapMapKeyPair, GapMapValuePair;
4847 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4853 GapMapEntry.first = GapMapKeyPair;
4856 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4860 GapMapEntry.second = GapMapValuePair;
4863 GapMap.insert(GapMapEntry);
4878 bool TrackElementPositionsOK =
true;
4880 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4892 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4893 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4894 "can't connect to an underpass or vice versa)");
4902 for(
unsigned int y = 0; y < 4; y++)
4920 bool ConnectionFoundFlag;
4924 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4930 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4939 if(ConnectionFoundFlag)
4946 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4948 TrackElementPositionsOK =
false;
4953 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4955 TrackElementPositionsOK =
false;
4960 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4964 TrackElementPositionsOK =
false;
4969 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4972 TrackElementPositionsOK =
false;
4976 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4979 TrackElementPositionsOK =
false;
4984 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4985 TrackElementPositionsOK =
false;
4988 if(!TrackElementPositionsOK)
4995 throw Exception(
"Error in track element positions in FinalCall");
5008 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5014 for(
unsigned int y = 0; y < 4; y++)
5036 bool ConnectionFoundFlag;
5037 bool LinkMatchFound =
false;
5040 if(ConnectionFoundFlag)
5042 for(
unsigned int a = 0; a < 4; a++)
5051 LinkMatchFound =
true;
5062 throw Exception(
"Error in final track linkage - - no matching link found");
5075 throw Exception(
"Error in final track linkage - connection not found");
5090 bool ConnErrorFlag =
false;
5092 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5096 ConnErrorFlag =
true;
5100 ConnErrorFlag =
true;
5104 ConnErrorFlag =
true;
5108 ConnErrorFlag =
true;
5116 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5125 throw Exception(
"ConnError in LinkTrack - Final");
5129 throw Exception(
"ConnError in LinkTrack - Precheck");
5132 bool CLkErrorFlag =
false;
5134 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5138 CLkErrorFlag =
true;
5142 CLkErrorFlag =
true;
5146 CLkErrorFlag =
true;
5150 CLkErrorFlag =
true;
5158 throw Exception(
"CLkError in LinkTrack - Final");
5162 throw Exception(
"CLkError in LinkTrack - Precheck");
5167 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5197 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5213 for(
unsigned int y = 0; y < 4; y++)
5232 bool ConnectionFoundFlag;
5238 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5247 if(ConnectionFoundFlag)
5250 bool LinkFoundFlag =
false;
5307 for(
unsigned int a = 0; a < 4; a++)
5316 LinkFoundFlag =
true;
5324 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5334 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5347 bool ConnErrorFlag =
false;
5349 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5353 ConnErrorFlag =
true;
5357 ConnErrorFlag =
true;
5361 ConnErrorFlag =
true;
5365 ConnErrorFlag =
true;
5373 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5382 throw Exception(
"ConnError in LinkTrack - Final");
5386 throw Exception(
"ConnError in LinkTrack - Precheck");
5389 bool CLkErrorFlag =
false;
5391 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5395 CLkErrorFlag =
true;
5399 CLkErrorFlag =
true;
5403 CLkErrorFlag =
true;
5407 CLkErrorFlag =
true;
5415 throw Exception(
"CLkError in LinkTrack - Final");
5419 throw Exception(
"CLkError in LinkTrack - Precheck");
5423 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5452 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5468 for(
unsigned int y = 0; y < 4; y++)
5487 bool ConnectionFoundFlag =
false;
5489 if(ConnectionFoundFlag)
5493 bool LinkFoundFlag =
false;
5513 for(
unsigned int a = 0; a < 4; a++)
5522 LinkFoundFlag =
true;
5542 bool ConnErrorFlag =
false;
5544 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5548 ConnErrorFlag =
true;
5552 ConnErrorFlag =
true;
5556 ConnErrorFlag =
true;
5560 ConnErrorFlag =
true;
5568 bool CLkErrorFlag =
false;
5570 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5574 CLkErrorFlag =
true;
5578 CLkErrorFlag =
true;
5582 CLkErrorFlag =
true;
5586 CLkErrorFlag =
true;
5604 int Position1, Position2;
5610 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5612 int HLoc1 = GapMapPtr->first.first;
5613 int VLoc1 = GapMapPtr->first.second;
5614 int HLoc2 = GapMapPtr->second.first;
5615 int VLoc2 = GapMapPtr->second.second;
5618 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5622 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5626 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5630 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5648 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5649 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5659 bool FoundFlag =
false;
5671 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5672 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5673 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5702 bool FoundFlag =
false;
5715 TrackMapKeyPair.first = TrackElement.
HLoc;
5716 TrackMapKeyPair.second = TrackElement.
VLoc;
5717 TrackMapEntry.first = TrackMapKeyPair;
5722 LocationNameEntry.second = -(int)(
TrackVector.size());
5762 TrackMapKeyPair.first = HLoc;
5763 TrackMapKeyPair.second = VLoc;
5764 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5774 return(TrackMapPtr->second);
5787 TrackMapKeyPair.first = HLoc;
5788 TrackMapKeyPair.second = VLoc;
5789 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5792 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5793 throw Exception(Message);
5811 MapKeyPair.first = HLoc;
5812 MapKeyPair.second = VLoc;
5813 MapPtr = Map.find(MapKeyPair);
5814 if(MapPtr == Map.end())
5816 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5817 throw Exception(Message);
5822 return(Vector.at(MapPtr->second));
5832 THVPair InactiveTrackMapKeyPair;
5835 InactiveTrackMapKeyPair.first = HLoc;
5836 InactiveTrackMapKeyPair.second = VLoc;
5840 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5841 throw Exception(Message);
5855 bool Present =
true;
5859 TrackMapKeyPair.first = HLoc;
5860 TrackMapKeyPair.second = VLoc;
5861 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5876 bool Present =
true;
5877 THVPair InactiveTrackMapKeyPair;
5880 InactiveTrackMapKeyPair.first = HLoc;
5881 InactiveTrackMapKeyPair.second = VLoc;
5899 THVPair InactiveTrackMapKeyPair;
5904 InactiveTrackMapKeyPair.first = HLoc;
5905 InactiveTrackMapKeyPair.second = VLoc;
5914 if(InactiveTrackRange.first == InactiveTrackRange.second)
5923 RetPair.first = InactiveTrackRange.first->second;
5924 RetPair.second = (--InactiveTrackRange.second)->second;
5937 AnsiString(DivergingPosition));
5948 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5949 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5950 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5951 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5952 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5953 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5954 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5955 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5956 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5957 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5958 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5959 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5993 throw Exception(
"Error, Wrong track type in PlotGap");
5995 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5999 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
6003 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
6007 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
6011 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
6015 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
6019 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
6023 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
6027 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
6031 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
6035 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
6039 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
6043 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
6047 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
6051 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
6055 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6071 PosPair.first = TrackElement.
HLoc;
6072 PosPair.second = TrackElement.
VLoc;
6076 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6089 throw Exception(
"Error, Wrong track type in PlotPoints");
6100 else if(TrackElement.
SpeedTag < 132)
6111 else if(!TrackElement.
Failed)
6118 else if(TrackElement.
SpeedTag < 132)
6136 else if(TrackElement.
SpeedTag < 132)
6170 throw Exception(
"Error, Wrong track type in PlotSignal");
6174 for(
int x = 0; x < 40; x++)
6245 for(
int x = 0; x < 40; x++)
6252 Graphics::TBitmap* SignalPlatformGraphic;
6267 for(
int x = 0; x < 8; x++)
6282 for(
int x = 0; x < 8; x++)
6373 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6381 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6389 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6397 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6413 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6421 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6429 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6437 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6470 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6482 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6494 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6506 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6548 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6550 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6552 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6555 if(BaseElementSpeedTag == 1)
6559 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6566 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6574 Graphics::TBitmap *RouteGraphic;
6576 if(TypeOfRoute == 1)
6580 else if(TypeOfRoute == 0)
6586 RouteGraphic = BaseGraphic;
6593 if(UpStep == DownStep)
6596 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6606 else if((DownStep - UpStep) == 1)
6611 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6621 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6634 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6644 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6660 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6670 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6680 else if(DownStep == 0)
6683 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6693 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6706 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6716 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6726 for(
int x = (UpStep + 1); x < DownStep; x++)
6731 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6735 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6756 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6763 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6769 Graphics::TBitmap *RouteGraphic;
6771 if(TypeOfRoute == 1)
6775 else if(TypeOfRoute == 0)
6781 RouteGraphic = BaseGraphic;
6790 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6800 else if((RStep - LStep) == 1)
6805 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6815 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6828 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6838 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6854 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6864 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6877 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6887 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6900 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6910 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6920 for(
int x = (LStep + 1); x < RStep; x++)
6925 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6929 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6953 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6956 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6958 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6960 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6963 if(BaseElementSpeedTag == 1)
6967 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6974 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6980 if(UpStep == DownStep)
6991 else if((DownStep - UpStep) == 1)
7010 for(
int x = (UpStep + 1); x < DownStep; x++)
7019 for(
int x = (UpStep + 1); x < DownStep; x++)
7026 for(
int x = UpStep; x <= DownStep; x++)
7039 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
7046 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
7063 else if((RStep - LStep) == 1)
7082 for(
int x = (LStep + 1); x < RStep; x++)
7091 for(
int x = (LStep + 1); x < RStep; x++)
7098 for(
int x = LStep; x <= RStep; x++)
7117 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
7119 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7121 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7124 if(BaseElementSpeedTag == 1)
7128 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7135 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7141 for(
int x = UpStep; x < (DownStep + 1); x++)
7156 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7163 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7169 for(
int x = LStep; x < (RStep + 1); x++)
7188 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7191 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7193 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7195 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7200 if(BaseElementSpeedTag == 1)
7204 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7211 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7217 for(
int x = UpStep; x <= DownStep; x++)
7231 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7238 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7244 for(
int x = LStep; x <= RStep; x++)
7260 Graphics::TBitmap *RouteGraphic;
7263 if(BaseElementSpeedTag == 1)
7265 if(TypeOfRoute == 1)
7269 else if(TypeOfRoute == 0)
7275 RouteGraphic = BaseGraphic;
7279 RouteGraphic = BaseGraphic;
7285 if(TypeOfRoute == 1)
7289 else if(TypeOfRoute == 0)
7295 RouteGraphic = BaseGraphic;
7299 RouteGraphic = BaseGraphic;
7304 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7309 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7313 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7320 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7323 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7328 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7333 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7337 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7344 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7347 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7472 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7476 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7507 "," + AnsiString(VLoc));
7511 int DummyRouteNumber;
7513 TrainPresent =
false;
7517 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7519 TrackMapKeyPair.first = HLoc;
7520 TrackMapKeyPair.second = VLoc + UpStep;
7521 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7530 TrainPresent =
true;
7544 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7546 TrackMapKeyPair.first = HLoc;
7547 TrackMapKeyPair.second = VLoc + DownStep;
7548 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7557 TrainPresent =
true;
7571 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7573 TrackMapKeyPair.first = HLoc + LeftStep;
7574 TrackMapKeyPair.second = VLoc;
7575 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7584 TrainPresent =
true;
7598 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7600 TrackMapKeyPair.first = HLoc + RightStep;
7601 TrackMapKeyPair.second = VLoc;
7602 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7611 TrainPresent =
true;
7631 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7648 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7651 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7657 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7664 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7670 for(
int x = UpStep; x <= DownStep; x++)
7677 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7684 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7690 for(
int x = LStep; x <= RStep; x++)
7706 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7713 else if(TrackElement.
SpeedTag < 132)
7731 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7748 AnsiString(ScreenPosV));
7763 AnsiString(ScreenPosV));
7774 AnsiString(VPosTrue));
7788 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7800 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7801 " in TrackMap, Caller=" + (AnsiString)Caller);
7803 if(MapVecPos != (
int)a)
7805 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7806 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7807 (AnsiString)Caller);
7813 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7814 " Caller=" + (AnsiString)Caller);
7834 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7835 " in InactiveMap, Caller=" + (AnsiString)Caller);
7837 if((InactivePair.first != a) && (InactivePair.second != a))
7839 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7840 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7841 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7846 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7847 " Caller=" + (AnsiString)Caller);
7857 int Position1, Position2;
7863 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7865 int HLoc1 = GapMapPtr->first.first;
7866 int VLoc1 = GapMapPtr->first.second;
7867 int HLoc2 = GapMapPtr->second.first;
7868 int VLoc2 = GapMapPtr->second.second;
7871 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7875 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7879 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7883 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7887 unsigned int GapCount = 0;
7889 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7897 if((
GapMap.size() * 2) != GapCount)
7899 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7900 (AnsiString)Caller);
7910 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7914 throw Exception(
"Error - TrackFinished with erase element still present");
7919 AnsiString IDString;
7921 if(TrackElement.
HLoc < 0)
7923 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7927 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7929 if(TrackElement.
VLoc < 0)
7931 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7935 IDString += AnsiString(TrackElement.
VLoc);
7950 for(
int x = 1; x < String.Length() + 1; x++)
7952 if(String.IsDelimiter(
"-", x))
7957 if(x == String.Length())
7961 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7971 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7976 if(DelimPos == String.Length())
7980 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7985 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7989 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7996 if(String.SubString(1, 1) !=
"N")
7998 for(
int x = 1; x < DelimPos; x++)
8000 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8004 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8011 if(String.SubString(1, 1) ==
"N")
8013 for(
int x = 2; x < DelimPos; x++)
8015 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8019 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8026 if(String.SubString(1, 1) ==
"N")
8028 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
8032 HLoc = String.SubString(1, DelimPos - 1).ToInt();
8034 if(String.SubString(DelimPos + 1, 1) !=
"N")
8036 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
8038 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8042 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8049 if(String.SubString(DelimPos + 1, 1) ==
"N")
8051 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
8053 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8057 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8064 if(String.SubString(DelimPos + 1, 1) ==
"N")
8066 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
8070 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
8075 TrackMapPtr =
TrackMap.find(HVPair);
8080 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
8086 return(TrackMapPtr->second);
8088 catch(
const Exception &e)
8091 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
8105 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
8106 int HLoc = TrackElement.
HLoc;
8107 int VLoc = TrackElement.
VLoc;
8210 AnsiString(SpeedTag));
8221 if(HVRange.first == HVRange.second)
8228 HVIt1 = HVRange.first;
8233 if(--HVRange.second != HVRange.first)
8235 HVIt2 = HVRange.second;
8239 HVIt2->second).
SpeedTag == SpeedTag)))
8259 AnsiString(SpeedTag));
8325 AnsiString TestString1, TestString2;
8330 throw Exception(
"LNPendingList size not 1 on entry");
8332 int CurrentElementNumber;
8338 int H = CurrentElement->HLoc;
8339 int V = CurrentElement->VLoc;
8340 int Tag = CurrentElement->SpeedTag;
8346 for(
int x = 0; x < 25; x++)
8356 for(
int x = 0; x < 25; x++)
8366 for(
int x = 0; x < 25; x++)
8376 for(
int x = 0; x < 25; x++)
8386 for(
int x = 0; x < 28; x++)
8396 for(
int x = 0; x < 8; x++)
8406 for(
int x = 0; x < 8; x++)
8416 for(
int x = 0; x < 4; x++)
8426 for(
int x = 0; x < 8; x++)
8436 for(
int x = 0; x < 8; x++)
8449 if(CurrentElementNumber > -1)
8454 if((ExistingName !=
"") && (ExistingName != LocationName))
8470 AddName(1, CurrentElement, LocationName);
8474 LNDone2MultiMapEntry.first = HVPair;
8485 bool FoundFlag, ErasedFlag =
false;
8487 if(SNRange.first != SNRange.second)
8491 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8498 TVIt->LocationName =
"";
8499 TVIt->ActiveTrackElementName =
"";
8532 std::pair<AnsiString, char>TempMapPair;
8540 TempMapPair.second =
'x';
8558 AnsiString(SpeedTag));
8568 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8575 int MapPos = -1 - Position;
8579 FoundElement = MapPos;
8595 FoundElement = IMPair.first;
8604 FoundElement = IMPair.second;
8625 AnsiString OldName = TrackElement->LocationName, ErrorString;
8627 TrackElement->LocationName = Name;
8628 int HLoc = TrackElement->HLoc;
8629 int VLoc = TrackElement->VLoc;
8643 if(ErrorString !=
"")
8645 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8669 if(LNDone2MultiMapIterator->second == MapPos)
8696 if(*LNPendingListIterator == MapPos)
8769 if(NameBeingChecked !=
"")
8775 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8783 NameBeingChecked = LNMMRg.second->first;
8785 if(NameBeingChecked !=
"")
8791 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8812 if(LNMMIt->second < 0)
8822 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8830 std::list<THVPair> HVLinkedList;
8833 HVPairsLinkedMap.begin()->second =
true;
8834 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8837 THVPair HVPairUnderExamination;
8838 THVPairsLinkedMap::iterator HVPLMIt;
8840 while(!HVLinkedList.empty())
8842 HVPairUnderExamination = HVLinkedList.front();
8843 HVLinkedList.pop_front();
8844 HVPairNew.first = HVPairUnderExamination.first;
8845 HVPairNew.second = HVPairUnderExamination.second - 1;
8846 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8847 if(HVPLMIt != HVPairsLinkedMap.end())
8849 if(!HVPLMIt->second)
8851 HVLinkedList.push_back(HVPLMIt->first);
8853 HVPLMIt->second =
true;
8855 HVPairNew.first = HVPairUnderExamination.first - 1;
8856 HVPairNew.second = HVPairUnderExamination.second;
8857 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8858 if(HVPLMIt != HVPairsLinkedMap.end())
8860 if(!HVPLMIt->second)
8862 HVLinkedList.push_back(HVPLMIt->first);
8864 HVPLMIt->second =
true;
8866 HVPairNew.first = HVPairUnderExamination.first;
8867 HVPairNew.second = HVPairUnderExamination.second + 1;
8868 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8869 if(HVPLMIt != HVPairsLinkedMap.end())
8871 if(!HVPLMIt->second)
8873 HVLinkedList.push_back(HVPLMIt->first);
8875 HVPLMIt->second =
true;
8877 HVPairNew.first = HVPairUnderExamination.first + 1;
8878 HVPairNew.second = HVPairUnderExamination.second;
8879 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8880 if(HVPLMIt != HVPairsLinkedMap.end())
8882 if(!HVPLMIt->second)
8884 HVLinkedList.push_back(HVPLMIt->first);
8886 HVPLMIt->second =
true;
8891 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8893 if(!HVPLMIt->second)
8912 if(LocationName ==
"")
8923 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8930 ActiveTrackElementNameMapEntry.second = 0;
8952 bool FoundFlag, ErasedFlag =
false;
8956 if(SNRange.first != SNRange.second)
8959 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8962 TVIt->LocationName =
"";
8963 TVIt->ActiveTrackElementName =
"";
8997 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8999 AnsiString LocationName;
9008 if(LocationName !=
"")
9016 if(LocationName !=
"")
9030 if(LocationName !=
"")
9032 int ModifiedPosition = -1 - Position;
9041 for(
int x = 0; x < 25; x++)
9051 else if(SpeedTag == 77)
9053 for(
int x = 0; x < 25; x++)
9063 else if(SpeedTag == 78)
9065 for(
int x = 0; x < 25; x++)
9075 else if(SpeedTag == 79)
9077 for(
int x = 0; x < 25; x++)
9087 else if(SpeedTag == 96)
9089 for(
int x = 0; x < 28; x++)
9099 else if(SpeedTag == 129)
9101 for(
int x = 0; x < 8; x++)
9111 else if(SpeedTag == 130)
9113 for(
int x = 0; x < 8; x++)
9123 else if(SpeedTag == 145)
9125 for(
int x = 0; x < 8; x++)
9135 else if(SpeedTag == 146)
9137 for(
int x = 0; x < 8; x++)
9147 else if(SpeedTag == 131)
9149 for(
int x = 0; x < 4; x++)
9172 AnsiString(SpeedTag));
9184 if(TempElement->LocationName !=
"")
9186 LocationName = TempElement->LocationName;
9187 FoundElement = IMPair.first;
9195 if(TempElement->LocationName !=
"")
9197 LocationName = TempElement->LocationName;
9198 FoundElement = IMPair.second;
9210 if(TempElement->LocationName !=
"")
9212 LocationName = TempElement->LocationName;
9213 FoundElement = -1 - Position;
9229 unsigned int Count = 0;
9236 AnsiString SName, TName, ErrorString;
9238 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9244 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9245 AnsiString(Caller));
9258 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9259 AnsiString(Caller));
9266 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9267 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9272 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9278 if(ErrorString !=
"")
9280 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9282 if(SNIt->second != -1 - (
int)x)
9284 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9285 AnsiString(Caller));
9291 bool FoundFlag =
false;
9300 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9301 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9305 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9306 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9307 AnsiString(Caller));
9312 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9313 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9323 if(ErrorString !=
"")
9325 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9327 if(SNIt->second != (
int)x)
9329 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9330 AnsiString(Caller));
9340 AnsiString &ErrorString)
9348 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9350 bool FoundFlag =
false;
9354 if(SNRange.first == SNRange.second)
9356 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9358 return(SNRange.first);
9362 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9364 if(SNIterator->second < 0)
9366 int TVPos = -1 - SNIterator->second;
9368 if(TVIt == TrackElement)
9377 int ITVPos = SNIterator->second;
9379 if(ITVIt == TrackElement)
9390 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9407 LocationNameEntry.first = NewName;
9408 LocationNameEntry.second = SNIterator->second;
9422 int TruePos = -1 - Position;
9426 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9436 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9459 InactiveTrack2MultiMapIterator++)
9461 if(InactiveTrack2MultiMapIterator->second > VecPos)
9463 InactiveTrack2MultiMapIterator->second--;
9471 LocationNameMultiMapIterator++)
9473 if(LocationNameMultiMapIterator->second < 0)
9477 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9479 LocationNameMultiMapIterator->second--;
9501 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9503 if(TrackMapIterator->second > VecPos)
9505 TrackMapIterator->second--;
9513 LocationNameMultiMapIterator++)
9515 if(LocationNameMultiMapIterator->second >= 0)
9521 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9523 LocationNameMultiMapIterator->second++;
9527 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9533 if(TkEl.
Conn[0] ==
int(VecPos))
9538 if(TkEl.
Conn[0] >
int(VecPos))
9542 if(TkEl.
Conn[0] > -1)
9568 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9574 LocationNameEntry.second = -1 - TVPos;
9585 LocationNameEntry.second = ITVPos;
9627 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9659 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9687 AnsiString((
short)FirstTrack));
9688 bool LengthDifferent =
false, SpeedDifferent =
false;
9695 int EXArray[16][2] =
9697 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9698 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9701 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9702 Graphics::TBitmap *Bitmap;
9706 InLink = TrackElement.
Link[0];
9707 OutLink = TrackElement.
Link[1];
9711 InLink = TrackElement.
Link[2];
9712 OutLink = TrackElement.
Link[3];
9714 for(
int x = 0; x < 16; x++)
9716 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9723 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9742 else if(TrackElement.
SpeedTag == 54)
9746 else if(TrackElement.
SpeedTag == 55)
9757 else if(TrackElement.
SpeedTag == 58)
9761 else if(TrackElement.
SpeedTag == 59)
9766 else if(Index == 14)
9772 else if(TrackElement.
SpeedTag == 52)
9776 else if(TrackElement.
SpeedTag == 57)
9781 else if(Index == 15)
9787 else if(TrackElement.
SpeedTag == 53)
9791 else if(TrackElement.
SpeedTag == 56)
9805 if(LengthDifferent && SpeedDifferent)
9873 else if(LengthDifferent && !SpeedDifferent)
10020 AnsiString((
short)FirstTrack));
10021 LengthDifferent =
false;
10022 SpeedDifferent =
false;
10027 LengthDifferent =
true;
10031 SpeedDifferent =
true;
10033 if(LengthDifferent || SpeedDifferent)
10046 LengthDifferent =
true;
10050 SpeedDifferent =
true;
10052 if(LengthDifferent || SpeedDifferent)
10065 LengthDifferent =
true;
10069 SpeedDifferent =
true;
10071 if(LengthDifferent || SpeedDifferent)
10151 AnsiString TempName;
10152 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10153 bool ForwardSet, ReverseSet;
10155 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10160 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10162 ForwardSet =
false;
10163 ReverseSet =
false;
10198 for(
int y = 0; y < 2; y++)
10229 StartElement = TempElement;
10230 StartVecPos = VecPos;
10233 EntryPos = 1 - Dir;
10234 StartEntryPos = 1 - Dir;
10243 VecPos = TempElement.
Conn[1 - EntryPos];
10244 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10246 EntryPos = TempEntryPos;
10274 ForwardNumber = ((Count + 1) / 2) + 1;
10275 ReverseNumber = (Count - ForwardNumber) + 1;
10277 EntryPos = 1 - Dir;
10278 TempElement = StartElement;
10279 VecPos = StartVecPos;
10280 if(Count == ForwardNumber)
10285 if(Count == ReverseNumber)
10293 VecPos = TempElement.
Conn[1 - EntryPos];
10294 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10296 EntryPos = TempEntryPos;
10298 if(Count == ForwardNumber)
10303 if(Count == ReverseNumber)
10315 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10451 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10507 if((TextH / 16) - 1 <
HLocMin)
10511 if((TextH / 16) + 1 >
HLocMax)
10515 if((TextV / 16) - 1 <
VLocMin)
10519 if((TextV / 16) + 1 >
VLocMax)
10549 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10550 bool &UserGraphicFoundFlag)
10553 TUserGraphicVector::iterator UserGraphicPtr;
10555 UserGraphicFoundFlag =
false;
10562 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10563 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10565 UserGraphicItem = x;
10566 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10567 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10568 UserGraphicFoundFlag =
true;
10586 int SpeedTag = TrackElement.
SpeedTag;
10590 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10639 return(GraphicOutput);
10647 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10650 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10663 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10664 " in InactiveTrackElementAt");
10675 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10677 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10702 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10703 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10707 if(SNRange.first == SNRange.second)
10712 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10714 if(SNIterator->second < 0)
10728 HVPair.first = InactiveElement.
HLoc;
10729 HVPair.second = InactiveElement.
VLoc;
10733 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10735 int TVPos =
TrackMap.find(HVPair)->second;
10738 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10744 FirstNamedExitPos = 0;
10746 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10748 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10749 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10752 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10754 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10755 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10756 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10759 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10769 FirstNamedExitPos = 1;
10771 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10773 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10774 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10777 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10779 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10780 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10781 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10784 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10800 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10814 AnsiString(FirstNamedElementPos));
10815 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10816 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10818 SecondNamedElementPos = -1;
10819 FirstNamedLinkedElementPos = -1;
10820 SecondNamedLinkedElementPos = -1;
10824 if(SNRange.first == SNRange.second)
10829 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10831 if(SNIterator->second < 0)
10841 HVPair.first = InactiveElement.
HLoc;
10842 HVPair.second = InactiveElement.
VLoc;
10854 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10858 int TVPos =
TrackMap.find(HVPair)->second;
10859 if(TVPos != FirstNamedElementPos)
10865 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10871 FirstNamedExitPos = 0;
10873 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10875 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10876 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10879 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10881 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10882 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10883 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10886 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10888 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10889 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10890 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10899 FirstNamedExitPos = 1;
10901 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10903 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10904 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10907 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10909 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10910 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10911 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10914 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10916 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10917 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10918 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10939 if(SNRange.first != SNRange.second)
10941 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10943 if(SNIterator->second < 0)
10965 "," + AnsiString(SpeedTag));
10976 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
11006 else if(SpeedTag == 69)
11032 else if(SpeedTag == 70)
11058 else if(SpeedTag == 71)
11095 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
11096 if(NextEntryPos < 0)
11109 if(NextEntryPos > 1)
11128 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
11140 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
11141 bool FoundFlag =
false;
11156 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
11157 bool FoundFlag =
false;
11182 VPosHi = 16 * VLocHi;
11183 VPosLo = 16 * VLocLo;
11202 AnsiString(EndTVPosition));
11213 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11214 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11215 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11216 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11218 if(Link0Squares <= Link1Squares)
11236 AnsiString(LinkPos));
11255 if((LinkPos == 1) && (TE.
Attribute == 0))
11260 else if(LinkPos == 1)
11266 else if((LinkPos == 3) && (TE.
Attribute == 1))
11271 else if(LinkPos == 3)
11278 else if(LinkPos == 0)
11283 else if(LinkPos == 1)
11288 else if(LinkPos == 2)
11293 else if(LinkPos == 3)
11298 throw Exception(
"Error, failure in GetExitPos");
11347 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11351 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11393 "," + AnsiString(DiagonalLinkNumber));
11398 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11403 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11408 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11413 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11429 AnsiString JustFileName =
"";
11434 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11441 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11460 typedef std::list<int> TNamePosList;
11461 TNamePosList NamePosList;
11462 typedef TNamePosList::iterator TNPLIt;
11464 typedef std::list<int> TOnePlatList;
11465 TOnePlatList OnePlatList;
11466 typedef TOnePlatList::iterator TOPLIt;
11469 NamePosList.clear();
11470 OnePlatList.clear();
11471 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11473 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11475 NamePosList.push_back(x);
11480 if(!NamePosList.empty())
11482 OnePlatList.push_back(NamePosList.back());
11483 NamePosList.pop_back();
11485 while(!OnePlatList.empty())
11487 TempInt = OnePlatList.front();
11490 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11491 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11493 OnePlatList.push_back(TempElement.
Conn[0]);
11494 NamePosList.erase(NPLIt);
11496 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11497 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11499 OnePlatList.push_back(TempElement.
Conn[1]);
11500 NamePosList.erase(NPLIt);
11503 OnePlatList.erase(OnePlatList.begin());
11504 if(OnePlatList.empty())
11507 if(!NamePosList.empty())
11509 OnePlatList.push_back(NamePosList.back());
11510 NamePosList.pop_back();
11526 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not signal in RepairFailedSignals");
11530 throw Exception(
"Signals not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedSignals");
11558 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not points in RepairFailedPoints");
11562 throw Exception(
"Points not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedPoints");
11588 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not simple in RepairFailedPoints");
11592 throw Exception(
"No TSR at " + AnsiString(FPVIt->TVPos) +
" in RepairTSR");
11614 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11633 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11648 throw Exception(
"Return value negative in call to LastElementNumber");
11660 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11674 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11686 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11687 " in GetModifiablePrefDirElementAt");
11697 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11699 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11709 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11711 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11728 int TrackVectorPosition;
11779 FinishElement =
false;
11780 int TrackVectorPosition;
11802 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11812 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11835 for(
int x = 0; x < 4; x++)
11858 FinishElement =
true;
11866 for(
int x = 0; x < 4; x++)
11878 FinishElement =
true;
11886 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11893 .ELinkPos] ==
Lead))
11909 FinishElement =
true;
11928 FinishElement =
true;
11947 FinishElement =
true;
11962 FinishElement =
true;
11971 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11987 FinishElement =
true;
11993 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12016 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
12017 int VectorCount = 0;
12021 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
12023 for(
int x = 0; x < VectorCount; x++)
12030 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
12034 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
12035 SearchElement.
ELinkPos = NextELinkPos;
12056 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
12058 SearchElement.
XLinkPos = NextXLinkPos;
12084 for(
int x = 0; x < VectorCount; x++)
12096 for(
int x = 0; x < VectorCount; x++)
12110 for(
int x = 0; x < VectorCount; x++)
12124 for(
int x = 0; x < VectorCount; x++)
12134 for(
int x = 0; x < VectorCount; x++)
12145 SearchElement.
XLink = SearchElement.
Link[1];
12164 SearchElement.
XLink = SearchElement.
Link[3];
12177 for(
int x = 0; x < VectorCount; x++)
12192 XLinkPos = NextXLinkPos;
12193 CurrentTrackElement = SearchElement;
12212 throw Exception(
"Error, SearchVector empty");
12219 for(
int x = 0; x < 4; x++)
12272 throw Exception(
"Error in EntryExitNumber 1");
12291 if(PrefDirElement.
XLink == -1)
12303 if(PrefDirElement.
XLink != -1)
12307 throw Exception(
"Error in EntryExitNumber 2");
12345 LeadingPoints =
false;
12373 LeadingPoints =
true;
12389 AnsiString ErrorString;
12390 bool Error =
false;
12397 ErrorString =
"HLoc";
12403 ErrorString =
"VLoc";
12409 ErrorString =
"ELink";
12415 ErrorString =
"ELinkPos";
12421 ErrorString =
"XLink";
12427 ErrorString =
"XLinkPos";
12433 ErrorString =
"Tag";
12439 ErrorString =
"TrackVectorPosition";
12445 ErrorString =
"EXNumber";
12452 ErrorString =
"CheckCount";
12459 ErrorString =
"EntryGraphicPtr";
12465 ErrorString =
"EntryDirectionGraphicPtr";
12474 ErrorString =
"Last XLink not connected to this element";
12481 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12505 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12562 AnsiString((
short)BuildingPrefDir));
12565 if(PrefDirSize() == 0)
12570 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12582 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12594 if(x == (PrefDirSize() - 1))
12603 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12605 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12606 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12607 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12609 if(PrefDirSize() > 1)
12611 unsigned int LatestPos = PrefDirSize() - 1;
12612 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12613 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12614 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12635 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12638 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12642 H = MMIT->first.first;
12643 V = MMIT->first.second;
12646 if(PrefDirPos0 > -1)
12650 if(PrefDirPos1 > -1)
12654 if(PrefDirPos2 > -1)
12658 if(PrefDirPos3 > -1)
12662 if(PrefDirPos3 > -1)
12678 else if(PrefDirPos2 > -1)
12720 else if(PrefDirPos1 > -1)
12743 else if(PrefDirPos0 > -1)
12762 int NumberOfPrefDirElements = 0;
12765 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12767 VecFile >> TempInt;
12770 VecFile >> TempInt;
12771 LoadPrefDirElement.
ELink = TempInt;
12772 VecFile >> TempInt;
12773 LoadPrefDirElement.
ELinkPos = TempInt;
12774 VecFile >> TempInt;
12775 LoadPrefDirElement.
XLink = TempInt;
12776 VecFile >> TempInt;
12777 LoadPrefDirElement.
XLinkPos = TempInt;
12778 VecFile >> TempInt;
12779 LoadPrefDirElement.
EXNumber = TempInt;
12780 VecFile >> TempInt;
12785 if(!(LoadPrefDirElement.
IsARoute))
12811 int NumberOfPrefDirElements = 0;
12814 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12816 VecFile >> TempInt;
12817 VecFile >> TempInt;
12820 VecFile >> TempInt;
12821 LoadPrefDirElement.
ELink = TempInt;
12822 VecFile >> TempInt;
12823 LoadPrefDirElement.
ELinkPos = TempInt;
12824 VecFile >> TempInt;
12825 LoadPrefDirElement.
XLink = TempInt;
12826 VecFile >> TempInt;
12827 LoadPrefDirElement.
XLinkPos = TempInt;
12828 VecFile >> TempInt;
12829 LoadPrefDirElement.
EXNumber = TempInt;
12830 VecFile >> TempInt;
12835 if(!(LoadPrefDirElement.
IsARoute))
12863 int NumberOfPrefDirElements = 0;
12866 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12871 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12878 VecFile >> TempInt;
12879 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12884 VecFile >> TempInt;
12885 if((TempInt < -1) || (TempInt > 9))
12890 VecFile >> TempInt;
12891 if((TempInt < -1) || (TempInt > 3))
12896 VecFile >> TempInt;
12897 if((TempInt < -1) || (TempInt > 9))
12902 VecFile >> TempInt;
12903 if((TempInt < -1) || (TempInt > 3))
12908 VecFile >> TempInt;
12909 if((TempInt < -1) || (TempInt > 27))
12914 VecFile >> TempInt;
12922 VecFile >> TempInt;
12923 if((TempInt != 0) && (TempInt != 1))
12928 VecFile >> TempInt;
12929 if((TempInt != 0) && (TempInt != 1))
12934 VecFile >> TempInt;
12935 if((TempInt != 0) && (TempInt != 1))
12958 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12960 VecFile << y <<
'\n';
12961 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12971 if(y == (NumberOfPrefDirElements - 1))
12973 VecFile <<
"************" <<
'\0' <<
'\n';
12977 VecFile <<
"******" <<
'\0' <<
'\n';
12991 for(
int y = 0; y < NumberOfSearchElements; y++)
12993 VecFile << y <<
'\n';
12994 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
13004 if(y == (NumberOfSearchElements - 1))
13006 VecFile <<
"************" <<
'\0' <<
'\n';
13010 VecFile <<
"******" <<
'\0' <<
'\n';
13123 bool AlreadyPresent, FoundFlag;
13124 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13126 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
13130 AlreadyPresent =
false;
13135 AlreadyPresent =
true;
13139 AlreadyPresent =
true;
13143 AlreadyPresent =
true;
13147 AlreadyPresent =
true;
13150 if(!AlreadyPresent)
13197 for(
unsigned int z = 0; z < 4; z++)
13205 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
13219 bool DiscrepancyFound =
false;
13230 DiscrepancyFound =
true;
13235 DiscrepancyFound =
true;
13240 DiscrepancyFound =
true;
13245 DiscrepancyFound =
true;
13250 DiscrepancyFound =
true;
13256 DiscrepancyFound =
true;
13259 if(DiscrepancyFound)
13261 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
13276 bool DiscrepancyFound =
false;
13287 DiscrepancyFound =
true;
13291 DiscrepancyFound =
true;
13296 DiscrepancyFound =
true;
13301 DiscrepancyFound =
true;
13306 DiscrepancyFound =
true;
13312 DiscrepancyFound =
true;
13316 return(!DiscrepancyFound);
13328 bool FoundFlag =
false;
13329 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13337 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13338 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13340 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13342 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13343 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13344 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13349 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13350 +
" Caller=" + (AnsiString)Caller);
13376 PrefDirMapKeyPair.first = HLoc;
13377 PrefDirMapKeyPair.second = VLoc;
13378 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13381 if(ItPair.first == ItPair.second)
13389 PrefDirPos0 = ItPair.first->second;
13391 if(ItPair.first == ItPair.second)
13396 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13398 PrefDirPos1 = ItPair.first->second;
13401 if(ItPair.first == ItPair.second)
13406 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13408 PrefDirPos2 = ItPair.first->second;
13411 if(ItPair.first == ItPair.second)
13416 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13418 PrefDirPos3 = ItPair.first->second;
13433 +
"," + AnsiString(LinkNumberPos));
13435 int PD0, PD1, PD2, PD3;
13436 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13440 PD0, PD1, PD2, PD3);
13452 LinkedPrefDirVectorNumber = PD0;
13461 LinkedPrefDirVectorNumber = PD1;
13471 LinkedPrefDirVectorNumber = PD0;
13480 LinkedPrefDirVectorNumber = PD1;
13489 LinkedPrefDirVectorNumber = PD2;
13498 LinkedPrefDirVectorNumber = PD3;
13503 LinkedPrefDirVectorNumber = -1;
13509 LinkedPrefDirVectorNumber = -1;
13514 catch(
const Exception &e)
13516 LinkedPrefDirVectorNumber = -1;
13531 +
"," + AnsiString(LinkNumberPos));
13533 int PD0, PD1, PD2, PD3;
13534 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13538 PD0, PD1, PD2, PD3);
13551 LinkedPrefDirVectorNumber = PD0;
13561 LinkedPrefDirVectorNumber = PD1;
13566 LinkedPrefDirVectorNumber = -1;
13574 LinkedPrefDirVectorNumber = PD0;
13583 LinkedPrefDirVectorNumber = PD1;
13592 LinkedPrefDirVectorNumber = PD2;
13601 LinkedPrefDirVectorNumber = PD3;
13606 LinkedPrefDirVectorNumber = -1;
13612 LinkedPrefDirVectorNumber = -1;
13617 catch(
const Exception &e)
13619 LinkedPrefDirVectorNumber = -1;
13631 int PD0, PD1, PD2, PD3;
13683 THVPair PrefDir4MultiMapKeyPair;
13686 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13687 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13688 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13711 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13730 AnsiString(ErasedElementNumber));
13735 if(MapPtr->second > ErasedElementNumber)
13757 throw Exception(
"PrefDirVectorPosition out of range");
13760 THVPair PrefDir4MultiMapKeyPair;
13762 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13763 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13764 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13767 if(ItPair.first == ItPair.second)
13770 return(ItPair.first);
13774 if(ItPair.first->second == PrefDirVectorPosition)
13778 return(ItPair.first);
13781 if(ItPair.first == ItPair.second)
13784 return(ItPair.first);
13786 if(ItPair.first->second == PrefDirVectorPosition)
13790 return(ItPair.first);
13793 if(ItPair.first == ItPair.second)
13796 return(ItPair.first);
13798 if(ItPair.first->second == PrefDirVectorPosition)
13802 return(ItPair.first);
13805 if(ItPair.first == ItPair.second)
13808 return(ItPair.first);
13810 if(ItPair.first->second == PrefDirVectorPosition)
13814 return(ItPair.first);
13818 return(ItPair.first);
13831 THVPair PrefDir4MultiMapKeyPair;
13833 PrefDir4MultiMapKeyPair.first = HLoc;
13834 PrefDir4MultiMapKeyPair.second = VLoc;
13835 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13838 if(ItPair.first == ItPair.second)
13846 return(ItPair.first->second);
13855 bool ErasedFlag =
false;
13857 if(ErasedTrackVectorPosition > -1)
13866 ErasedFlag =
false;
13868 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13873 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13878 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13883 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13888 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13896 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13900 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13904 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13908 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13912 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13927 OverallDistance = 0;
13928 OverallSpeedLimit = 0;
13929 LeadingPointsAtLastElement =
false;
13937 LeadingPointsAtLastElement =
true;
13946 OverallDistance += PrefDirElement.
Length23;
13947 if(OverallSpeedLimit != -1)
13957 OverallSpeedLimit = -1;
13964 OverallDistance += PrefDirElement.
Length01;
13965 if(OverallSpeedLimit != -1)
13975 OverallSpeedLimit = -1;
13994 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13997 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14001 HLoc = MMIT->first.first;
14002 VLoc = MMIT->first.second;
14007 if(PrefDirPos0 > -1)
14011 if(PrefDirPos1 > -1)
14015 if(PrefDirPos2 > -1)
14019 if(PrefDirPos3 > -1)
14023 if(PrefDirPos3 > -1)
14026 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14028 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14030 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14032 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
14039 else if(PrefDirPos2 > -1)
14044 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14046 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14048 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
14057 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14059 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14061 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14070 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14072 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14074 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14081 else if(PrefDirPos1 > -1)
14086 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14088 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14096 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14098 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14104 else if(PrefDirPos0 > -1)
14106 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14123 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14126 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14148 if(PrefDirPos0 > -1)
14152 if(PrefDirPos1 > -1)
14156 if(PrefDirPos2 > -1)
14160 if(PrefDirPos3 > -1)
14164 if(PrefDirPos3 > -1)
14169 else if(PrefDirPos2 > -1)
14171 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
14182 else if(PrefDirPos1 > -1)
14184 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
14195 else if(PrefDirPos0 > -1)
14197 if(PrefDirElement0.
XLinkPos == EntryPos)
14234 ElementIn.
VLoc +
"," + XLink);
14236 bool TrackFoundFlag;
14239 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
14251 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14261 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14275 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14285 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14299 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14309 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14323 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14333 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14356 bool FoundFlag, ContFlag, FoundElements =
false;
14357 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14362 LastIteratorValue++;
14388 if(PDVIt->XLinkPos == 0)
14393 StartElement = *PDVIt;
14402 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
14404 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14405 if(PrefDirPos0 == -1)
14409 bool NextElementFoundFlag =
false;
14413 NextElementFoundFlag =
true;
14415 if(PrefDirPos1 > -1)
14420 NextElementFoundFlag =
true;
14423 if(PrefDirPos2 > -1)
14428 NextElementFoundFlag =
true;
14431 if(PrefDirPos3 > -1)
14436 NextElementFoundFlag =
true;
14439 if(!NextElementFoundFlag)
14469 EndElement = NextElement;
14473 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
14475 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14476 if(PrefDirPos0 == -1)
14486 if(PrefDirPos1 > -1)
14494 if(PrefDirPos2 > -1)
14502 if(PrefDirPos3 > -1)
14533 FoundElements =
true;
14567 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14569 int TrackVectorPosition;
14605 int LockedVectorNumber;
14628 bool InPrefDirFlag =
false;
14631 int PrefDirPos0 = -1;
14632 int PrefDirPos1 = -1;
14633 int PrefDirPos2 = -1;
14634 int PrefDirPos3 = -1;
14638 int PrefDirVecPos[4] =
14640 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14643 for(
int x = 0; x < 4; x++)
14645 int b = PrefDirVecPos[x];
14655 InPrefDirFlag =
true;
14668 TrainController->
StopTTClockMessage(12,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14676 if(DummyPair.first > -1)
14678 throw Exception(
"Selection in two routes - should never happen!");
14680 if(RoutePair.first > -1)
14756 IDInt &ReqPosRouteID,
bool &PointsChanged)
14790 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14792 int NewFailedPointsTVPos = -1;
14841 bool InPrefDirFlag =
false;
14844 int PrefDirPos0 = -1;
14845 int PrefDirPos1 = -1;
14846 int PrefDirPos2 = -1;
14847 int PrefDirPos3 = -1;
14850 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14851 int PrefDirVecPos[4] =
14853 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14856 for(
int x = 0; x < 4; x++)
14858 int b = PrefDirVecPos[x];
14861 InPrefDirFlag =
true;
14874 TrainController->
StopTTClockMessage(23,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14883 if(RoutePair.first > -1)
14885 if(RoutePair.second != 0)
14902 EndElement1 = RouteElement;
14903 EndElement2 = BlankElement;
14998 AutoSigsFlag,
false))
15003 if(NewFailedPointsTVPos > -1)
15007 " failed during route setting.");
15011 PointsChanged =
true;
15034 AutoSigsFlag,
false))
15039 if(NewFailedPointsTVPos > -1)
15043 " failed during route setting.");
15047 PointsChanged =
true;
15065 AutoSigsFlag,
false))
15070 if(NewFailedPointsTVPos > -1)
15074 " failed during route setting.");
15078 PointsChanged =
true;
15102 AutoSigsFlag,
false))
15107 if(NewFailedPointsTVPos > -1)
15111 " failed during route setting.");
15115 PointsChanged =
true;
15124 AutoSigsFlag,
false))
15129 if(NewFailedPointsTVPos > -1)
15133 " failed during route setting.");
15137 PointsChanged =
true;
15148 AutoSigsFlag,
false))
15153 if(NewFailedPointsTVPos > -1)
15157 " failed during route setting.");
15161 PointsChanged =
true;
15167 AutoSigsFlag,
false))
15172 if(NewFailedPointsTVPos > -1)
15176 " failed during route setting.");
15180 PointsChanged =
true;
15191 AutoSigsFlag,
false))
15196 if(NewFailedPointsTVPos > -1)
15200 " failed during route setting.");
15204 PointsChanged =
true;
15258 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag,
bool RecursiveCall)
15310 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
15311 AnsiString((
short)AutoSigsFlag));
15312 int VectorCount = 0;
15316 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
15320 for(
int x = 0; x < VectorCount; x++)
15328 bool FirstPass =
true;
15338 for(
int x = 0; x < VectorCount; x++)
15347 for(
int x = 0; x < VectorCount; x++)
15359 for(
int x = 0; x < VectorCount; x++)
15367 int NextPosition = PrefDirElement.
Conn[XLinkPos];
15371 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
15372 SearchElement.
ELinkPos = NextELinkPos;
15373 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
15394 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
15396 SearchElement.
XLinkPos = NextXLinkPos;
15409 for(
int x = 0; x < VectorCount; x++)
15423 if(RoutePair.first > -1)
15432 for(
int x = 0; x < VectorCount; x++)
15441 if(SecondPair.first > -1)
15450 for(
int x = 0; x < VectorCount; x++)
15464 for(
int x = 0; x < VectorCount; x++)
15475 for(
int x = 0; x < VectorCount; x++)
15484 for(
int x = 0; x < VectorCount; x++)
15493 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15497 for(
int x = 0; x < VectorCount; x++)
15507 bool InPrefDirFlag =
false;
15508 PrefDirElement1 = BlankElement;
15509 PrefDirElement2 = BlankElement;
15512 int PrefDirPos0 = -1;
15513 int PrefDirPos1 = -1;
15514 int PrefDirPos2 = -1;
15515 int PrefDirPos3 = -1;
15518 int PrefDirVecPos[4] =
15520 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15522 for(
int x = 0; x < 4; x++)
15524 int b = PrefDirVecPos[x];
15527 InPrefDirFlag =
true;
15540 for(
int x = 0; x < VectorCount; x++)
15552 for(
int x = 0; x < VectorCount; x++)
15568 for(
int x = 0; x < VectorCount; x++)
15588 for(
int x = 0; x < VectorCount; x++)
15600 for(
int x = 0; x < VectorCount; x++)
15614 for(
int x = 0; x < VectorCount; x++)
15624 for(
int x = 0; x < VectorCount; x++)
15655 for(
int x = 0; x < VectorCount; x++)
15664 for(
int x = 0; x < VectorCount; x++)
15676 int SearchPos1 = SearchElement.
Attribute + 1;
15678 if(SearchPos1 == 2)
15682 if(SearchPos1 == 1)
15690 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15691 SearchElement.
XLinkPos = SearchPos1;
15692 InPrefDirFlag =
false;
15693 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15695 SearchElement = PrefDirElement1;
15696 InPrefDirFlag =
true;
15698 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15700 SearchElement = PrefDirElement2;
15701 InPrefDirFlag =
true;
15707 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15711 for(
int x = 0; x < VectorCount; x++)
15729 AutoSigsFlag,
true))
15738 for(
int x = 0; x < VectorCount; x++)
15747 for(
int x = 0; x < VectorCount; x++)
15765 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15766 SearchElement.
XLinkPos = SearchPos2;
15767 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15769 SearchElement = PrefDirElement1;
15771 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15773 SearchElement = PrefDirElement2;
15777 for(
int x = 0; x < VectorCount; x++)
15785 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15789 for(
int x = 0; x < VectorCount; x++)
15808 AutoSigsFlag,
true))
15817 for(
int x = 0; x < VectorCount; x++)
15826 for(
int x = 0; x < VectorCount; x++)
15838 for(
int x = 0; x < VectorCount; x++)
15848 SearchElement = PrefDirElement1;
15857 XLinkPos = SearchElement.
XLinkPos;
15858 PrefDirElement = SearchElement;
15915 unsigned int TruncatePrefDirPosition = 0;
15988 throw Exception(
"Error - failed to validate extended route for preferred route");
16043 throw Exception(
"Error - failed to validate single route for preferred route");
16088 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
16090 int TrackVectorPosition;
16127 int LockedVectorNumber;
16161 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
16162 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
16165 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
16171 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
16172 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
16175 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
16189 if(RoutePair.first > -1)
16324 int NewFailedPointsTVPos = -1;
16389 EndElement1.
ELink = EndElement1.
Link[0];
16390 EndElement1.
XLink = EndElement1.
Link[1];
16393 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
16398 EndElement2.
ELink = EndElement2.
Link[1];
16399 EndElement2.
XLink = EndElement2.
Link[0];
16402 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
16446 if(RoutePair.first > -1)
16448 if(RoutePair.second != 0)
16471 EndElement2 = BlankElement;
16556 if(NewFailedPointsTVPos > -1)
16560 " failed during route setting.");
16564 PointsChanged =
true;
16590 if(NewFailedPointsTVPos > -1)
16594 " failed during route setting.");
16598 PointsChanged =
true;
16620 if(NewFailedPointsTVPos > -1)
16624 " failed during route setting.");
16628 PointsChanged =
true;
16654 if(NewFailedPointsTVPos > -1)
16658 " failed during route setting.");
16662 PointsChanged =
true;
16676 if(NewFailedPointsTVPos > -1)
16680 " failed during route setting.");
16684 PointsChanged =
true;
16724 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16725 int VectorCount = 0;
16728 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16729 (CurrentTrackElement.
Link[XLinkPos] == 9))
16733 for(
int x = 0; x < VectorCount; x++)
16745 for(
int x = 0; x < VectorCount; x++)
16752 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16754 for(
int x = 0; x < VectorCount; x++)
16761 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16765 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16766 SearchElement.
ELinkPos = NextELinkPos;
16787 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16789 SearchElement.
XLinkPos = NextXLinkPos;
16802 for(
int x = 0; x < VectorCount; x++)
16816 if(RoutePair.first > -1)
16825 for(
int x = 0; x < VectorCount; x++)
16834 if(SecondPair.first > -1)
16843 for(
int x = 0; x < VectorCount; x++)
16857 for(
int x = 0; x < VectorCount; x++)
16868 for(
int x = 0; x < VectorCount; x++)
16877 for(
int x = 0; x < VectorCount; x++)
16886 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16890 for(
int x = 0; x < VectorCount; x++)
16903 for(
int x = 0; x < VectorCount; x++)
16931 for(
int x = 0; x < VectorCount; x++)
16944 for(
int x = 0; x < VectorCount; x++)
16954 for(
int x = 0; x < VectorCount; x++)
16979 for(
int x = 0; x < VectorCount; x++)
16988 for(
int x = 0; x < VectorCount; x++)
17001 int SearchPos1 = SearchElement.
Attribute + 1;
17003 if(SearchPos1 == 2)
17007 if(SearchPos1 == 1)
17016 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
17017 SearchElement.
XLinkPos = SearchPos1;
17019 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17023 for(
int x = 0; x < VectorCount; x++)
17041 for(
int x = 0; x < VectorCount; x++)
17057 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
17058 SearchElement.
XLinkPos = SearchPos2;
17060 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17064 for(
int x = 0; x < VectorCount; x++)
17080 for(
int x = 0; x < VectorCount; x++)
17092 for(
int x = 0; x < VectorCount; x++)
17107 CurrentTrackElement = SearchElement;
17108 XLinkPos = SearchElement.
XLinkPos;
17130 throw Exception(
"Error, SearchVector empty");
17142 for(
int x = 0; x < 4; x++)
17184 throw Exception(
"Error in EntryExitNumber 3");
17239 unsigned int TruncatePrefDirPosition = 0;
17299 throw Exception(
"Failed to validate extended route for nonpreferred route");
17344 throw Exception(
"Failed to validate single route for nonpreferred route");
17364 if(!PrefDirVector.empty())
17368 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
17373 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
17408 if(!PrefDirVector.empty())
17411 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
17413 int ForwardLinkedRouteNumber, Attribute = 0;
17420 if(ForwardLinkedRouteNumber > -1)
17422 int NextForwardLinkedRouteNumber = -1;
17426 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
17437 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
17454 NewFailedPointsTVPos = -1;
17455 bool PointsChanged =
false;
17463 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
17473 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
17474 IFE.
TVPos = NewFailedPointsTVPos;
17493 PointsChanged =
true;
17496 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
17506 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
17507 IFE.
TVPos = NewFailedPointsTVPos;
17526 PointsChanged =
true;
17532 return(PointsChanged);
17553 NextForwardLinkedRouteNumber = -1;
17554 for(
unsigned int x = 0; x < PrefDirSize(); x++)
17556 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
17557 if(PrefDirVector.at(x).TrackType ==
Bridge)
17559 if(PrefDirVector.at(x).XLinkPos < 2)
17561 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit01;
17565 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit23;
17573 if(PrefDirVector.at(x).TrackType ==
Buffers)
17585 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
17594 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
17596 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute;
17608 if(x == PrefDirSize() - 1)
17652 AnsiString(PrefDirVectorStartPosition));
17657 bool SkipContinuationAndBufferAttributeChange =
false;
17659 if(!PrefDirVector.empty())
17661 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
17664 if(PrefDirPtr->TrackType ==
Bridge)
17666 if(PrefDirPtr->XLinkPos < 2)
17677 SkipContinuationAndBufferAttributeChange =
true;
17692 SkipContinuationAndBufferAttributeChange =
true;
17700 SkipContinuationAndBufferAttributeChange =
true;
17702 if(!SkipContinuationAndBufferAttributeChange)
17704 if(PrefDirVector.back().TrackType ==
Buffers)
17713 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
17716 if(PrefDirPtr->TrackType ==
Bridge)
17718 if(PrefDirPtr->XLinkPos < 2)
17734 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
17743 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
17745 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
17746 PrefDirPtr->PrefDirRoute)
17750 int LockedVecNum = 0;
17752 bool KeepAttributeAt0ForLockedRoute =
false;
17757 KeepAttributeAt0ForLockedRoute =
true;
17762 bool NotGroundSignal =
false;
17765 NotGroundSignal =
true;
17790 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute && (NotGroundSignal || (Attribute == 0)))
17819 "," + AnsiString((
short)PrefDirRoute));
17820 bool ElementInRoute =
false;
17821 bool TrainOccupyingRoute =
false;
17827 ElementInRoute =
true;
17831 if(!ElementInRoute)
17859 TrainOccupyingRoute =
true;
17926 if(LRVIT->RouteNumber == RouteNumber)
17940 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17941 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17953 bool ExistingLockedRouteModified =
false;
17966 if(LRVIT->RouteNumber == RouteNumber)
17970 ExistingLockedRouteModified =
true;
17974 if(!ExistingLockedRouteModified)
18064 AnsiString((
short)PrefDirRoute));
18089 AnsiString((
short)PrefDirRoute));
18099 RouteFlashElement.
HLoc = H;
18100 RouteFlashElement.
VLoc = V;
18116 int H = PrefDirPtr->HLoc;
18117 int V = PrefDirPtr->VLoc;
18184 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
18190 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
18193 OverlayPlotted =
false;
18216 bool FirstSignalFound =
false;
18223 if(PDVIt->TrackType ==
Points)
18225 if((PDVIt->ELinkPos == 1) || (PDVIt->XLinkPos == 1))
18236 else if((PDVIt->ELinkPos == 3) || (PDVIt->XLinkPos == 3))
18251 int XLinkPosition = PDVIt->XLinkPos;
18252 if(PDVIt->XLinkPos == -1)
18256 for(
int x = 0; x < 4; x++)
18258 if(PDVIt->Conn[x] == (PDVIt + 1)->TrackVectorPosition)
18271 if(XLinkPosition > -1)
18273 if(!FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
18275 FirstSignalFound =
true;
18278 else if(FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
18289 IFE.
TVPos = PDVIt->TrackVectorPosition;
18295 " failed when changing aspect.\nTrains can only pass under signaller control.");
18325 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
18327 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
18330 return(AllRoutesVector.at(At));
18338 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
18340 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
18343 return(AllRoutesVector.at(At));
18354 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18356 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
18366 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18368 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
18386 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
18387 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18390 RouteTruncateFlag =
true;
18392 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
18393 RouteTruncateFlag =
false;
18422 AnsiString(LinkPos));
18423 if(TrackVectorPosition == -1)
18428 THVPair Route2MultiMapKeyPair;
18432 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18435 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18445 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18447 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18450 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
18451 Route2MultiMapIterator->second.second);
18452 EntryLinkPos = PrefDirElement1.
ELinkPos;
18453 ExitLinkPos = PrefDirElement1.
XLinkPos;
18454 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18455 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18467 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18479 Graphics::TBitmap* &EntryDirectionGraphicPtr)
18489 AnsiString(LinkPos));
18492 if(TrackVectorPosition == -1)
18497 THVPair Route2MultiMapKeyPair;
18501 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18504 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18509 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18511 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18513 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
18514 Route2MultiMapIterator->second.second);
18515 EntryLinkPos = PrefDirElement1.
ELinkPos;
18516 ExitLinkPos = PrefDirElement1.
XLinkPos;
18517 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18518 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18522 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
18523 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
18530 return(AutoSigsRoute);
18535 return(NotAutoSigsRoute);
18541 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
18542 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
18549 return(AutoSigsRoute);
18554 return(NotAutoSigsRoute);
18558 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18560 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18561 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18563 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
18564 EntryLinkPos = PrefDirElement2.
ELinkPos;
18565 ExitLinkPos = PrefDirElement2.
XLinkPos;
18566 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
18567 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
18571 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
18578 return(AutoSigsRoute);
18583 return(NotAutoSigsRoute);
18589 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
18596 return(AutoSigsRoute);
18601 return(NotAutoSigsRoute);
18605 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
18606 EntryLinkPos = PrefDirElement3.
ELinkPos;
18607 ExitLinkPos = PrefDirElement3.
XLinkPos;
18608 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
18609 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
18613 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
18620 return(AutoSigsRoute);
18625 return(NotAutoSigsRoute);
18631 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
18638 return(AutoSigsRoute);
18643 return(NotAutoSigsRoute);
18659 AnsiString(LinkPos));
18660 if(TrackVectorPosition == -1)
18666 THVPair Route2MultiMapKeyPair;
18670 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18673 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18679 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18681 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18683 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
18684 Route2MultiMapIterator->second.second);
18685 EntryLinkPos = PrefDirElement1.
ELinkPos;
18686 ExitLinkPos = PrefDirElement1.
XLinkPos;
18687 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18688 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18691 RouteNumber = Route2MultiMapIterator->second.first;
18695 return(AutoSigsRoute);
18700 return(NotAutoSigsRoute);
18705 RouteNumber = Route2MultiMapIterator->second.first;
18709 return(AutoSigsRoute);
18714 return(NotAutoSigsRoute);
18718 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18720 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18721 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18723 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
18724 EntryLinkPos = PrefDirElement2.
ELinkPos;
18725 ExitLinkPos = PrefDirElement2.
XLinkPos;
18726 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
18727 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
18730 RouteNumber = ItPair.first->second.first;
18734 return(AutoSigsRoute);
18739 return(NotAutoSigsRoute);
18744 RouteNumber = ItPair.first->second.first;
18748 return(AutoSigsRoute);
18753 return(NotAutoSigsRoute);
18757 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
18758 EntryLinkPos = PrefDirElement3.
ELinkPos;
18759 ExitLinkPos = PrefDirElement3.
XLinkPos;
18760 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
18761 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
18764 RouteNumber = ItPair.second->second.first;
18768 return(AutoSigsRoute);
18773 return(NotAutoSigsRoute);
18778 RouteNumber = ItPair.second->second.first;
18782 return(AutoSigsRoute);
18787 return(NotAutoSigsRoute);
18809 EmptyRoute.
RouteID = NextRouteID;
18812 AllRoutesVector.push_back(EmptyRoute);
18813 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18838 AllRoutesVector.push_back(EmptyRoute);
18839 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18862 THVPair Route2MultiMapKeyPair;
18871 LockedRouteTruncateTrackVectorPosition = 0;
18872 LockedRouteLastTrackVectorPosition = 0;
18873 LockedRouteLastXLinkPos = 0;
18874 LockedRouteLockStartTime = TDateTime(0);
18875 if(!LockedRouteVector.empty())
18879 if(LRVIT->RouteNumber == RouteNumber)
18881 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
18882 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
18883 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
18884 LockedRouteLockStartTime = LRVIT->LockStartTime;
18885 LockedRouteFoundDuringRouteBuilding =
true;
18886 LockedRouteVector.erase(LRVIT);
18911 AnsiString(VLoc) +
"," + AnsiString(ELink));
18914 ReturnPair.first = -1;
18915 ReturnPair.second = 0;
18916 THVPair Route2MultiMapKeyPair;
18918 Route2MultiMapKeyPair.first = HLoc;
18919 Route2MultiMapKeyPair.second = VLoc;
18922 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18923 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18925 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18926 Route2MultiMapIterator = ItPair.first;
18928 if(ItPair.first == ItPair.second)
18930 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
18932 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
18934 ReturnPair.first = ItPair.first->second.first;
18935 ReturnPair.second = ItPair.first->second.second;
18936 Route2MultiMapIterator = ItPair.first;
18938 return(ReturnPair);
18941 if(ItPair.first == ItPair.second)
18943 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
18945 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
18947 ReturnPair.first = ItPair.first->second.first;
18948 ReturnPair.second = ItPair.first->second.second;
18949 Route2MultiMapIterator = ItPair.first;
18951 return(ReturnPair);
18954 return(ReturnPair);
18969 AnsiString(VLoc) +
"," + AnsiString(ELink));
18970 THVPair Route2MultiMapKeyPair;
18972 Route2MultiMapKeyPair.first = HLoc;
18973 Route2MultiMapKeyPair.second = VLoc;
18974 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18976 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18978 if(ItPair.first == ItPair.second)
18984 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18986 RouteNumber = ItPair.first->second.first;
18992 if(ItPair.first == ItPair.second)
18998 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
19000 RouteNumber = ItPair.first->second.first;
19021 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
19022 THVPair Route2MultiMapKeyPair;
19024 Route2MultiMapKeyPair.first = HLoc;
19025 Route2MultiMapKeyPair.second = VLoc;
19028 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
19031 RouteElementPair.first = RouteNumber;
19032 RouteElementPair.second = RouteElementNumber;
19033 Route2MultiMapEntry.second = RouteElementPair;
19035 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
19038 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
19039 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
19042 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
19043 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
19045 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
19047 Route2MultiMap.insert(Route2MultiMapEntry);
19052 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
19057 Route2MultiMap.insert(Route2MultiMapEntry);
19075 TempPair.first = -1;
19076 TempPair.second = 0;
19077 SecondPair = TempPair;
19079 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
19080 THVPair Route2MultiMapKeyPair;
19082 Route2MultiMapKeyPair.first = HLoc;
19083 Route2MultiMapKeyPair.second = VLoc;
19084 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19089 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19091 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19093 return(Route2MultiMapIterator->second);
19095 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19097 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
19098 TempPair = ItRange.first->second;
19099 SecondPair = (--ItRange.second)->second;
19122 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
19123 if(RouteElementPair.first == -1)
19126 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
19127 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
19129 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
19132 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
19133 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
19134 (AnsiString)Caller);
19136 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
19139 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
19140 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
19141 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
19142 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
19146 unsigned int SizeVal = 0;
19149 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19151 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
19153 if(SizeVal != Route2MultiMap.size())
19155 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
19156 (AnsiString)Caller);
19172 if(!Route2MultiMap.empty())
19174 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
19176 if(Route2MultiMapIterator->second.first > RouteNumber)
19178 Route2MultiMapIterator->second.first--;
19195 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
19196 if(!Route2MultiMap.empty())
19198 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
19200 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
19202 Route2MultiMapIterator->second.second--;
19221 AnsiString(ELink));
19225 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
19226 if(RequiredRoutePair.first == -1)
19228 throw Exception(
"Failed to find route element in RemoveRouteElement");
19230 Route2MultiMap.erase(Route2MultiMapIterator);
19231 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
19234 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
19255 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
19256 RequiredRoutePair.second)));
19267 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
19275 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
19277 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
19278 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
19279 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
19291 if(!LockedRouteVector.empty())
19295 if(LRVIT->RouteNumber > RequiredRoutePair.first)
19297 LRVIT->RouteNumber--;
19307 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
19309 AutoSigVectorIT->RouteNumber--;
19314 CheckMapAndRoutes(7);
19328 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
19329 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
19330 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
19346 "," + AnsiString(XLinkPos));
19350 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
19351 if(RouteElementPair.first == -1)
19353 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
19355 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
19357 RequiredPair = RouteElementPair;
19358 if(RouteElement.
XLinkPos != XLinkPos)
19360 if(SecondPair.first != -1)
19362 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
19363 RequiredPair = SecondPair;
19364 if(RouteElement.
XLinkPos != XLinkPos)
19366 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
19371 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
19375 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
19395 AnsiString(AccessNumber));
19397 int Attribute = AccessNumber + 1;
19399 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
19403 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
19407 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
19410 x).XLinkPos] !=
End)
19412 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
19415 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
19458 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
19459 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
19460 int RearwardLinkedRouteNumber;
19486 int TrainID, TrainPosition, BehindTrainPosition;
19487 bool FoundTrain =
false, BehindTrain =
false;
19488 for(
int x = RouteStartPosition; x >= 0; x--)
19490 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
19515 if(FoundTrain && (TrainPosition > 1))
19517 for(
int x = TrainPosition; x >= 0; x--)
19522 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
19542 BehindTrain =
true;
19543 BehindTrainPosition = x;
19550 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
19567 AnsiString(RouteTruncatePosition));
19568 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
19569 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
19572 bool ExamineRoute =
true;
19574 while(ExamineRoute)
19576 for(
int x = StartPosition; x >= 0; x--)
19618 if(SignalCount >= 3)
19637 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
19638 ExamineRoute =
true;
19639 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
19674 ExamineRoute =
false;
19689 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
19692 PrefDirElement = InternalPrefDirElement;
19693 if(LockedRouteVector.empty())
19700 bool InLockedRoute =
false;
19704 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
19708 InLockedRoute =
true;
19717 int RouteNumber, VectorCount = 0;
19722 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
19723 if(RouteType == NoRoute)
19729 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
19732 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
19734 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
19736 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
19737 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
19741 PrefDirElement = InternalPrefDirElement;
19742 LockedVectorNumber = VectorCount;
19747 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
19751 PrefDirElement = InternalPrefDirElement;
19752 LockedVectorNumber = VectorCount;
19773 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19775 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
19781 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
19791 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19793 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
19808 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19810 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
19813 return(GetFixedRouteAt(159, x));
19816 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19824 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19826 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
19829 return(GetModifiableRouteAt(15, x));
19832 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19842 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19844 TOneRoute OneRoute = GetFixedRouteAt(165, x);
19856 int NumberOfRoutes;
19860 for(
int x = 0; x < NumberOfRoutes; x++)
19867 StoreOneRouteAfterSessionLoad(0, &OneRoute);
19885 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
19892 if((NextID < 0) || (NextID > 1000000))
19897 for(
int x = 0; x < NumberOfRoutes; x++)
19922 AnsiString(StartPosition));
19923 if(EndPosition == StartPosition)
19929 int TVPos = EndPosition;
19930 int LkPos = EndXLinkPos;
19932 while(TrackIsInARoute(15, TVPos, LkPos))
19959 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19968 if((NewLkPos == 0) || (NewLkPos == 2))
19988 if(TVPos == StartPosition)
20020 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
20025 if(FirstPair.first > -1)
20028 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20033 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20039 if(SecondPair.first > -1)
20042 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20047 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20053 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
20060 if(FirstPair.first > -1)
20063 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20068 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20074 if(SecondPair.first > -1)
20077 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20082 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20088 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
20095 if(FirstPair.first > -1)
20098 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20103 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20109 if(SecondPair.first > -1)
20112 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20117 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20123 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
20130 if(FirstPair.first > -1)
20133 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20138 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20144 if(SecondPair.first > -1)
20147 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20152 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20158 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
20182 "," + AnsiString(DiagonalLinkNumber));
20187 if(FirstPair.first > -1)
20190 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20195 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20201 if(SecondPair.first > -1)
20204 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20209 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20216 if(FirstPair.first > -1)
20219 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20224 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20230 if(SecondPair.first > -1)
20233 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20238 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20245 if(FirstPair.first > -1)
20248 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20253 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20259 if(SecondPair.first > -1)
20262 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20267 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20274 if(FirstPair.first > -1)
20277 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20282 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20288 if(SecondPair.first > -1)
20291 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20296 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))